package api

import (
	"food-mgr/api-getaway/config"
	"food-mgr/api-getaway/handler/request"
	"food-mgr/api-getaway/response"
	__ "food-mgr/food-service/proto"
	"github.com/gin-gonic/gin"
	"log"
	"net/http"
)

func ListRider(c *gin.Context) {

	var rider request.Rider
	err := c.ShouldBind(&rider)
	if err != nil {
		response.Error(c, "转化失败")
		return
	}
	r, err := config.FoodClient.ListRider(c, &__.ListRiderReq{})
	if err != nil {
		return
	}
	if err != nil {
		log.Fatalf("could not greet: %v", err)
	}
	c.JSON(http.StatusOK, gin.H{
		"code": r.Code,
		"msg":  r.Msg,
		"data": r.List,
	})
}
